package utils;

import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: Shawn
 * Date: 2009-11-1
 * Time: 18:14:19
 */
public class TimeUtils {

  public static String GetyyyyMM(long milsec) {
    if (milsec == -1) return "";

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
    return dateFormat.format(new Date(milsec));
  }

  public static long GetMilsecTimeyyyyMM(String date) throws ParseException {
    if (date.trim().length() == 0) return -1;

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
    return dateFormat.parse(date).getTime();
  }
}
